<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="application/msword"/>
    <title>toWord</title>
    <style type="text/css">
        .bg {
            background-color: rgb(84, 127, 177);
        }

        table {
            table-layout: fixed;
        }

        tr {
            height: 20px;
            font-size: 12px;
        }

        td {
            overflow: hidden;
            word-break: break-all;
            word-wrap: break-word;
        }

        .specialHeight {
            height: 40px;
        }
    </style>
</head>

<body>
<div style="width:800px; margin: 0 auto">
    <div th:each="model,modelStat:${models}">
        <h3 th:text="${modelStat.count+'.'+model.title}"></h3>
        <div th:each="api,apiStat:${model.apiList}">
            <h4 th:text="${modelStat.count+'.'+apiStat.count+'.'+api.tag}"></h4>
            <h5 th:text="${modelStat.count+'.'+apiStat.count+'.1接口说明'}"></h5>
            <table border="1" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td>URL</td>
                    <td colspan="4" th:text="${api.url}"></td>
                </tr>
                <tr>
                    <td>请求方式</td>
                    <td colspan="4" th:text="${api.requestType}"></td>
                </tr>
                <tr>
                    <td>请求类型</td>
                    <td colspan="4" th:text="${api.requestForm}"></td>
                </tr>
            </table>
            <h5 th:text="${modelStat.count+'.'+apiStat.count+'.2请求参数'}"></h5>
            <table border="1" cellspacing="0" cellpadding="0" width="100%">
                <tr class="bg" align="center">
                    <td>参数名</td>
                    <td>字段名</td>
                    <td>参数类型</td>
                    <td>是否必填</td>
                    <td>说明</td>
                </tr>
                <div th:each="request:${api.requestList}">
                    <tr align="center">
                        <td th:text="${request.name}"></td>
                        <td th:text="${request.param}"></td>
                        <td th:text="${request.type}"></td>
                        <td th:if="${request.required}" th:text="Y"></td>
                        <td th:unless="${request.required}" th:text="N"></td>
                        <td th:text="${request.note}"></td>
                    </tr>
                    <tr th:if="${request.type == 'array' or request.type == 'object' and request.parameters != null}">
                        <td colspan="5" th:text="${request.name+'格式如下'}"></td>
                    </tr>
                    <tr align="center" th:each="parameter:${request.parameters}"
                        th:if="${request.type == 'array' or request.type == 'object' and request.parameters != null}">
                        <td th:text="${parameter.name}"></td>
                        <td th:text="${parameter.param}"></td>
                        <td th:text="${parameter.type}"></td>
                        <td th:if="${parameter.required}" th:text="Y"></td>
                        <td th:unless="${parameter.required}" th:text="N"></td>
                        <td th:text="${parameter.note}"></td>
                    </tr>
                    <tr th:if="${request.type == 'array' or request.type == 'object' and request.parameters != null}">
                        <td colspan="5"></td>
                    </tr>
                </div>
            </table>
            <h5 th:text="${modelStat.count+'.'+apiStat.count+'.3返回参数'}"></h5>
            <table border="1" cellspacing="0" cellpadding="0" width="100%">
                <tr class="bg" align="center">
                    <td>参数名</td>
                    <td>字段名</td>
                    <td>参数类型</td>
                    <td>说明</td>
                </tr>
                <div th:each="response:${api.responseList}">
                    <tr align="center">
                        <td th:text="${response.name}"></td>
                        <td th:text="${response.param}"></td>
                        <td th:text="${response.type}"></td>
                        <td th:text="${response.note}"></td>
                    </tr>
                    <tr th:if="${response.type == 'array' or response.type == 'object' and response.parameters != null}">
                        <td colspan="4" th:text="${response.name+'格式如下'}"></td>
                    </tr>
                    <tr align="center" th:each="parameter:${response.parameters}"
                        th:if="${response.type == 'array' or response.type == 'object' and response.parameters != null}">
                        <td th:text="${parameter.name}"></td>
                        <td th:text="${parameter.param}"></td>
                        <td th:text="${parameter.type}"></td>
                        <td th:text="${parameter.note}"></td>
                    </tr>
                    <tr th:if="${response.type == 'array' or response.type == 'object' and response.parameters != null}">
                        <td colspan="4"></td>
                    </tr>
                </div>
            </table>
            <h5 th:text="${modelStat.count+'.'+apiStat.count+'.4示例'}"></h5>
            <table border="1" cellspacing="0" cellpadding="0" width="100%">
                <tr class="specialHeight">
                    <td class="bg">请求参数</td>
                    <td colspan="4" th:text="${api.requestParam}"></td>
                </tr>
                <tr class="specialHeight">
                    <td class="bg">返回值</td>
                    <td colspan="4" th:text="${api.responseParam}"></td>
                </tr>
            </table>
        </div>
    </div>
</div>
</body>
</html>
